package cn.ycc1.boot3.ssm.controller;

import cn.ycc1.boot3.ssm.bean.TUser;
import cn.ycc1.boot3.ssm.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title:
 * @Author ycc
 * @Date 2023/7/1 16:50
 */
@RestController
public class UserController {

    @Autowired
    UserMapper userMapper;

    /**
     * 返回user的json数据
     * @param id
     * @return
     */
    @GetMapping("/user/{id}")
    public TUser getUser(@PathVariable("id") Long id) {
        TUser user = userMapper.getUserById(id);
        return user;
    }
}
